import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
@WebServlet(name = "LoginServlet ",urlPatterns = "/LoginServlet")
public class LoginServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        String username = request.getParameter("username");
        String password = request.getParameter("password");

        if (username.equals("admin") &&password.equals("123")) {

            response.setHeader("refresh","2;url=https://new.dlnu.edu.cn");

//            request.setAttribute("username",username);
//            RequestDispatcher rd = request.getRequestDispatcher("/welcomeServlet");
//            rd.forward(request,response);
//            System.out.println("登陆成功");

        } else {

            System.out.println("用户名密码错误");

        }
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
        doGet(request, response);
    }
}